﻿using System;
using System.Windows.Forms;
using LinkDownloader.Forms.OptionPanels;
using System.Collections.Generic;

namespace LinkDownloader.Forms
{
    public partial class frmOptions : Form
    {

        private List<OptionPanel> panels = null;

        private OptionPanel activePanel = null;

        private OptionPanelGeneral panelGeneral = null;

        public frmOptions()
        {
            InitializeComponent();
            this.panels = new List<OptionPanel>();
            this.DialogResult = DialogResult.Cancel;
        }

        private void LoadSettings()
        {
            // add code to initialize the settings from the static Settings class
        }

        private void SaveSettings()
        {
            this.activePanel.SaveChanges();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnApply_Click(object sender, EventArgs e)
        {
            this.SaveSettings();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.SaveSettings();
            this.Close();
        }
        
        private void treeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node != null)
            {
                if (e.Node.Nodes.Count > 0)
                {
                    this.SelectNode(e.Node.Nodes[0]);
                }
            }
        }

        private void SelectNode(TreeNode node)
        {
            // this.activePanel = *SOMETHING*
        }

        private void HideAllPanels()
        {
            foreach (OptionPanel p in this.panels)
            {
                p.Hide();
            }
        }

    }
}
